const { log } = require("console")
var fs = require("fs")
var http = require("http"); 
const path = require("path");
const en =  http.createServer((request,response)=>{
    console.log("启动成功");
     fs.readFile("public/index.html","utf8",(a,b)=>{  

        console.log(b);
        const en6 =  path.basename('public/index.html')
        console.log(en6.search('html'));
        
        if(en6.search('html')!=-1){
            response.end(b)
            response.setHeader(Cont)

        }else if(en6.search('css')!=-1){
            response.end(b)
            

        } else if(en6.search('')!=-1){
            
                response.end(b)

        }else{     
            response.statusCode = 404 
            response.end("no")
           
            
            
        }
           
        
        
    })
    
})

en.listen(8080)